/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cw.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author VinhTC
 */
@Entity
@Table(name = "tblSubject")
@NamedQueries({
    @NamedQuery(name = "Subject.findAll", query = "SELECT s FROM Subject s"),
    @NamedQuery(name = "Subject.findBySubjectId", query = "SELECT s FROM Subject s WHERE s.subjectId = :subjectId"),
    @NamedQuery(name = "Subject.findBySbjName", query = "SELECT s FROM Subject s WHERE s.sbjName like :sbjName"),
    @NamedQuery(name = "Subject.findBySbjDescription", query = "SELECT s FROM Subject s WHERE s.sbjDescription = :sbjDescription"),
    @NamedQuery(name = "Subject.findByStatus", query = "SELECT s FROM Subject s WHERE s.status = :status")})
public class Subject implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "SubjectId")
    private Integer subjectId;
    @Column(name = "SbjName")
    private String sbjName;
    @Column(name = "SbjDescription")
    private String sbjDescription;
    @Basic(optional = false)
    @Column(name = "Status")
    private boolean status;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "subject")
    private List<Puzzle> puzzleList;

    public Subject() {
    }

    public Subject(Integer subjectId) {
        this.subjectId = subjectId;
    }

    public Subject(Integer subjectId, boolean status) {
        this.subjectId = subjectId;
        this.status = status;
    }

    public Integer getSubjectId() {
        return subjectId;
    }

    public void setSubjectId(Integer subjectId) {
        this.subjectId = subjectId;
    }

    public String getSbjName() {
        return sbjName;
    }

    public void setSbjName(String sbjName) {
        this.sbjName = sbjName;
    }

    public String getSbjDescription() {
        return sbjDescription;
    }

    public void setSbjDescription(String sbjDescription) {
        this.sbjDescription = sbjDescription;
    }

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public List<Puzzle> getPuzzleList() {
        return puzzleList;
    }

    public void setPuzzleList(List<Puzzle> puzzleList) {
        this.puzzleList = puzzleList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (subjectId != null ? subjectId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Subject)) {
            return false;
        }
        Subject other = (Subject) object;
        if ((this.subjectId == null && other.subjectId != null) || (this.subjectId != null && !this.subjectId.equals(other.subjectId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cw.entity.Subject[subjectId=" + subjectId + "]";
    }

}
